<template>
  <div>
      <Row style="margin-bottom:10px">
      <label style="font-size:16px">
         用户名
         </label>
         <Input v-model="username" placeholder="用户名" clearable style="width: 350px" />
         </Row>
                  <Row style="margin-bottom:10px">
 <label style="font-size:16px">
         手机号
         </label>
         <Input v-model="phone" placeholder="手机号" clearable style="width: 350px"/>
</Row>
    <Row style="margin-bottom:10px">
 <label style="font-size:16px">
         邮箱
         </label>
         <Input v-model="email" placeholder="邮箱" clearable style="width: 350px"/>
</Row>
         <Row style="margin-bottom:10px">
 <label style="font-size:16px">
         密码
         </label>
         <Input v-model="password" placeholder="密码" clearable style="width: 350px" type="password"/>
</Row>
  <Row style="margin-bottom:10px">
 <label style="font-size:16px">
         重复密码
         </label>
         <Input v-model="repsword" placeholder="重复密码" clearable style="width: 350px" type="password"/>
</Row>
<Row>
    <Button @click="register" type="error" >注册</Button>
</Row>
  </div>
</template>


<script>
import service from '../../service/index.js'
export default {
    name:'register',
    props:['id','name'],
    mounted() {
        //console.log(this.$route.query.id, this.$route.query.name)
         console.log(this.id, this.name)

    },
    data(){
        return{
            username:'',
            phone:'',
            email:'',
            password:'',
            repsword:''
        }
    },
    methods:{
        register()
{
   
   if(this.password == ''){
      alert('密码不能为空');
      return false;
   }
   if(this.password != this.repsword) {
      alert("两次密码不同，请重新输入");
      return false; 
   }

     console.log(this.username,this.phone,this.email,this.password)
     service.post('/v1/register',{
         body: JSON.stringify({
             username:this.username,
             phone:this.phone,
             email:this.email,
             password:this.password,
         })
     })
     .then((res)=>{
         console.log(res)
     })
    },      
    
    }
}
</script>